/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package top.dusin.dyjccomm.test;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import javagprssrv.JGS_Param;

/**
 * 生成5m分钟数据
 * @author dusin
 */
public class Gen5mThread extends Thread{

    public Gen5mThread() {
        super("Gen5mThread");
    }
    
    int count = 0;
    @Override
    public void run(){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        while(count<110000){
            String dataTime = sdf.format(cal.getTime());
            for(int pid=8880001;pid<8881500;pid++){
                double voltage = Math.random()*30+200;
                JGS_Param.queueFor5m.add(new Object[]{pid,pid,dataTime,voltage});
            }  
            cal.add(Calendar.MINUTE, 5);
            try {
                Thread.sleep(1000L);
            } catch (InterruptedException ex) {
                
            }
            System.out.println("*******"+JGS_Param.queueFor5m.size());
            count++;
        }
    }            
}
